Package-level declarations

Types

Link copied to clipboard
class CoroutineProgressReporter(reporter: ProgressReporter) : AbstractCoroutineContextElement, ProgressReporter

Captures progress information about the currently running task.

Link copied to clipboard
class StateFlowProgressReporter : ProgressReporter

ProgressReporter implementation which stores the latest progress information in progress, a StateFlow.

Functions

Link copied to clipboard

Wraps this ProgressReporter into a CoroutineProgressReporter so it can be inserted in a CoroutineContext.

Link copied to clipboard
@ExperimentalProgressApi
fun <Value> captureProgress(block: suspend () -> Value): Flow<Progressive<Value?>>

Captures calls to report within block and reports them as a Flow.

Link copied to clipboard
@ExperimentalProgressApi
fun <Value> Flow<Value>.captureProgress(): Flow<Progressive<Value?>>

Captures calls to report within the given flow and reports them as a new Flow.

Link copied to clipboard
suspend fun <R> mapProgressTo(progressInterval: ClosedFloatingPointRange<Double>, block: suspend () -> R): R

Reduces progress events emitted in block to fit into progressInterval.

Link copied to clipboard
suspend fun report(progress: Progress)

Reports progress to the progress reporter stored in the currentCoroutineContext.

Link copied to clipboard
suspend fun reportProgress(onProgress: (Progress) -> Unit, block: suspend () -> Unit)

Captures all calls to report in block and transmits them to onProgress.

Link copied to clipboard
suspend fun <R> transformProgress(createChildReporter: (ProgressReporter) -> ProgressReporter, block: suspend () -> R): R

Passes the current ProgressReporter to createChildReporter to create a new child reporter of the current coroutine, and adds it to block's context.